<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      google.setOnLoadCallback(drawChart_Bidon);
      google.setOnLoadCallback(drawChart_FBshared);
      google.setOnLoadCallback(drawChart_TWshared);
      google.setOnLoadCallback(drawChart_PINshared);
	  
      function drawChart() {
        var data = new google.visualization.DataTable();
		var myrow = new Array('');
								
		data.addColumn('string', 'string');
        data.addColumn('number', 'How many people Bid on which image been Bid on');
		data.addColumn('number', 'How many people visit the page');
		data.addColumn('number', 'How many twitter post by keyword #Hands4Habitat');
		data.addColumn('number', 'How many Pinterest post by keyword #Hands4Habitat');
		data.addColumn('number', 'How many facebook shared via our Varspar App');
		
		<?php
		$link = @mysql_connect("localhost","root","root");
		@mysql_query("set names 'UTF8'");
		@mysql_select_db("valspar") or die("can not select database");
		
		//How many people Bid on which image been Bid on.
		$sql = "select * from bidon";
		$result= mysql_query($sql);
		$numResult_bidon = mysql_num_rows($result);
		
		//How many people visit the page.
		$sql = "select * from visitapp";
		$result= mysql_query($sql);
		$numResult_visitapp = mysql_num_rows($result);
		
		//How many twitter post by keyword #Hands4Habitat.
		$sql = "select * from twshared";
		$result= mysql_query($sql);
		$numResult_twkeyword = mysql_num_rows($result);
		
		//How many Pinterest post by keyword #Hands4Habitat.
		$sql = "select * from pinshared";
		$result= mysql_query($sql);
		$numResult_pinkeyword = mysql_num_rows($result);
		
		//How many facebook shared via our Varspar App.
		$sql = "select * from fbshared";
		$result= mysql_query($sql);
		$numResult_fbshared = mysql_num_rows($result);
		?>
		
		myrow.push(<?php echo $numResult_bidon; ?>, <?php echo $numResult_visitapp; ?>, <?php echo $numResult_twkeyword; ?>,
					<?php echo $numResult_pinkeyword; ?>, <?php echo $numResult_fbshared; ?>);
					
        // A column for custom tooltip content
		data.addRows([myrow]);

        var options = {
        };

        var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
	  
	  
	  function drawChart_Bidon() {
        var data = new google.visualization.DataTable();
		var myrow = new Array('');
								
		data.addColumn('string', 'string');
		
		<?php
		
		//How many people Bid on which image been Bid on.
		$sql = "SELECT photo.name name, count(bidon.photo_id) count FROM photo 
				LEFT JOIN bidon ON photo.ID = bidon.photo_id GROUP BY photo.ID";
		$result= mysql_query($sql);
		
		while($row = mysql_fetch_assoc($result)) {
			
			$name = $row['name'];
			$count = $row['count'];
			
			?>
			data.addColumn('number', '<?php echo $name; ?>');
			myrow.push(<?php echo $count; ?>);
			<?php
			
		}
		
		?>
					
        // A column for custom tooltip content
		data.addRows([myrow]);

        var options = {
			title: 'Bid on'
        };

        var chart = new google.visualization.ColumnChart(document.getElementById('chart_div_bidon'));
        chart.draw(data, options);
      }
	  
	  
	  function drawChart_FBshared() {
        var data = new google.visualization.DataTable();
		var myrow = new Array('');
								
		data.addColumn('string', 'string');
		
		<?php
		
		//How many people Bid on which image been Bid on.
		$sql = "SELECT photo.name name, count(fbshared.photo_id) count FROM photo 
				LEFT JOIN fbshared ON photo.ID = fbshared.photo_id GROUP BY photo.ID";
		$result= mysql_query($sql);
		
		while($row = mysql_fetch_assoc($result)) {
			
			$name = $row['name'];
			$count = $row['count'];
			
			?>
			data.addColumn('number', '<?php echo $name; ?>');
			myrow.push(<?php echo $count; ?>);
			<?php
			
		}
		
		?>
					
        // A column for custom tooltip content
		data.addRows([myrow]);

        var options = {
			title: 'Facebook Shared'
        };

        var chart = new google.visualization.ColumnChart(document.getElementById('chart_div_fbshared'));
        chart.draw(data, options);
      }
	  
	  
	  function drawChart_TWshared() {
        var data = new google.visualization.DataTable();
		var myrow = new Array('');
								
		data.addColumn('string', 'string');
		
		<?php
		
		//How many people Bid on which image been Bid on.
		$sql = "SELECT photo.name name, count(twshared.photo_id) count FROM photo 
				LEFT JOIN twshared ON photo.ID = twshared.photo_id GROUP BY photo.ID";
		$result= mysql_query($sql);
		
		while($row = mysql_fetch_assoc($result)) {
			
			$name = $row['name'];
			$count = $row['count'];
			
			?>
			data.addColumn('number', '<?php echo $name; ?>');
			myrow.push(<?php echo $count; ?>);
			<?php
			
		}
		
		?>
					
        // A column for custom tooltip content
		data.addRows([myrow]);

        var options = {
			title: 'Twitter Shared'
        };

        var chart = new google.visualization.ColumnChart(document.getElementById('chart_div_twshared'));
        chart.draw(data, options);
      }
	  
	  
	  function drawChart_PINshared() {
        var data = new google.visualization.DataTable();
		var myrow = new Array('');
								
		data.addColumn('string', 'string');
		
		<?php
		
		//How many people Bid on which image been Bid on.
		$sql = "SELECT photo.name name, count(pinshared.photo_id) count FROM photo 
				LEFT JOIN pinshared ON photo.ID = pinshared.photo_id GROUP BY photo.ID";
		$result= mysql_query($sql);
		
		while($row = mysql_fetch_assoc($result)) {
			
			$name = $row['name'];
			$count = $row['count'];
			
			?>
			data.addColumn('number', '<?php echo $name; ?>');
			myrow.push(<?php echo $count; ?>);
			<?php
			
		}
		
		?>
					
        // A column for custom tooltip content
		data.addRows([myrow]);

        var options = {
			title: 'Pinterest Shared'
        };

        var chart = new google.visualization.ColumnChart(document.getElementById('chart_div_pinshared'));
        chart.draw(data, options);
      }
	  
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 80%; height: 500px;"></div>
    <div id="chart_div_bidon" style="width: 80%; height: 500px;"></div>
    <div id="chart_div_fbshared" style="width: 80%; height: 500px;"></div>
    <div id="chart_div_twshared" style="width: 80%; height: 500px;"></div>
    <div id="chart_div_pinshared" style="width: 80%; height: 500px;"></div>
  </body>
</html>